package com.hz.ys_system.action;


import java.util.Map;

import com.hz.admin.util.SessionListener;
import com.hz.framework.MyAction.BaseAction;
import com.hz.framework.dao.CommonDao;
import com.hz.framework.util.DateUtil;
import com.hz.ys_system.bean.PresUserinfo;
import com.hz.ys_system.dao.SystemDao;

/**
 * *****************************************************************************
 *               Copyright(c) 2010 by 哈尔滨华泽数码科技有限公司.
 *                       All rights reserved.
 *******************************************************************************
 *     File Name         :  com.hz.hzsearch.action.DynamicAction.java
 *     Description(说明)	: 动态查询检索 action
 * -----------------------------------------------------------------------------
 *     No.        Date              Revised by           Description	
 *     			  Jul 29, 2011           韩飞              Created
 *****************************************************************************
 */
public class UserInfoAction extends BaseAction {

	private static final long serialVersionUID = 1L;
	
	private Object pagList = null;
	private PresUserinfo puser = new PresUserinfo();
	
	/**
	 * @author 韩飞
	 * @time Jun 8, 2011
	 * @return
	 * @throws Exception 
	 * 方法功能: 审批设定页面跳转
	 */
	public String UserInfoManage() throws Exception {
		boolean selflag = true;
		boolean pagflag = false;
		String rn = SUCCESS;
		SystemDao sd = new SystemDao();
		String operate = CommonDao.isnull(request.getParameter("operate"));
		String time = CommonDao.isnull(request.getParameter("time"));
//		保存信息
		if("insinfo".equals(operate)){
			request.setAttribute("msg", sd.DoSaveUserInfo(puser));
			request.setAttribute("createtime", DateUtil.getTime());
			rn = "rect";
			selflag = false;
		}
		if("delinfo".equals(operate)){
			request.setAttribute("msg", sd.DelUserInfo(time));
			time = "";
			request.setAttribute("createtime", DateUtil.getTime());
			rn = "rect";
			selflag = true;
		}
//		默认列表页面
		if(selflag){
			
			if(!"".equals(time)){
				sd.UpdUserInfo(time);
			}
			request.setAttribute("timelist", sd.SelTimeInfo());
			
			request.setAttribute("userinfo", sd.SelUserInfo());
			
			request.setAttribute("onlineuser", SessionListener.getList());
			pagflag = false;
		}
//		配置分页
		if(pagflag){
			doAllSearchList(request, "listinfo", pagList, "jdbc");
		}
		
		return rn;
	}

	public PresUserinfo getPuser() {
		return puser;
	}

	public void setPuser(PresUserinfo puser) {
		this.puser = puser;
	}

}
